import java.util.Scanner;

public class NGuessNumber {
    public static void main(String[] args) {
        NGuessNumber nGuessNumber = new NGuessNumber();
        nGuessNumber.compareGuessAnswer();

    }
        public int[] generateAnswer () {
            int a, b, c, d;
            int[] i = new int[]{};
            for (; ; ) {
                a = (int) (Math.random() * 9);
                b = (int) (Math.random() * 9);
                c = (int) (Math.random() * 9);
                d = (int) (Math.random() * 9);
                if (a != b && a != c && a != d && b != c && b != d) {
                    i = new int[]{a, b, c, d};
                    break;
                }
            }
            return i;
        }
        public int[] getPlayerInput () {
            int f[] = new int[]{};
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入第一个数");
            int one = scanner.nextInt();
            System.out.println("请输入第二个数");
            int two = scanner.nextInt();
            System.out.println("请输入第三个数");
            int three = scanner.nextInt();
            System.out.println("请输入第四个数");
            int four = scanner.nextInt();
            f = new int[]{one, two, three, four};
            return f;
        }
        public int iswin () {
            int e[] = generateAnswer();
            int f[] = getPlayerInput();
            int A = 0;
            for (int i = 0; i < e.length - 1; i++) {
                for (int j = 0; j < f.length; j++) {
                    if (e[i] == f[j]) {
                        A++;
                    }
                }
            }
            return A;
        }
        public boolean compareGuessAnswer () {
            int e[] = generateAnswer();
            for (; ; ) {
                int f[] = getPlayerInput();
                for (int i = 0; i < e.length - 1; i++) {
                    for (int j = 0; j < f.length; j++) {
                        if (e[i] == f[j]) {
                            System.out.println("您输入的：" + f[j] + "是正确的");
                        }
                    }
                }
                int A = iswin();
                if (A == 4) {
                    System.out.println("true");
                } else {
                    System.out.println("false");
                }
            }
        }

    }
